gint calc_width;
gint calc_height;
gint xpad, ypad;
+ GtkStyleContext *context;
+ GtkBorder border, padding;
priv = GTK_CELL_RENDERER_TOGGLE (cell)->priv;
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
- calc_width = xpad * 2 + priv->indicator_size;
- calc_height = ypad * 2 + priv->indicator_size;
+
+ context = gtk_cell_renderer_toggle_save_context (cell, widget);
+ gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &padding);
+ gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
+
+ calc_width = xpad * 2 + priv->indicator_size + padding.left + padding.right + border.left + border.right;
+ calc_height = ypad * 2 + priv->indicator_size + padding.top + padding.bottom + border.top + border.bottom;
+
+ gtk_style_context_restore (context);
if (width)
*width = calc_width;
gint x_offset, y_offset;
gint xpad, ypad;
GtkStateFlags state;
+ GtkBorder padding, border;
context = gtk_widget_get_style_context (widget);
gtk_cell_renderer_toggle_get_size (cell, widget, cell_area,
context = gtk_cell_renderer_toggle_save_context (cell, widget);
gtk_style_context_set_state (context, state);
- if (priv->radio)
- {
- gtk_render_option (context, cr,
+ gtk_render_background (context, cr,
cell_area->x + x_offset + xpad,
cell_area->y + y_offset + ypad,
width, height);
+ gtk_render_frame (context, cr,
+ cell_area->x + x_offset + xpad,
+ cell_area->y + y_offset + ypad,
+ width, height);
+
+ gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &padding);
+ gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
+
+ if (priv->radio)
+ {
+ gtk_render_option (context, cr,
+ cell_area->x + x_offset + xpad + padding.left + border.left,
+ cell_area->y + y_offset + ypad + padding.top + border.top,
+ width - padding.left - padding.right - border.left - border.right,
+ height - padding.top - padding.bottom - border.top - border.bottom);
}
else
{
gtk_render_check (context, cr,
- cell_area->x + x_offset + xpad,
- cell_area->y + y_offset + ypad,
- width, height);
+ cell_area->x + x_offset + xpad + padding.left + border.left,
+ cell_area->y + y_offset + ypad + padding.top + border.top,
+ width - padding.left - padding.right - border.left - border.right,
+ height - padding.top - padding.bottom - border.top - border.bottom);
}
gtk_style_context_restore (context);